package com.banmoon.datastructure.BalanceBinaryTree;

public class Test {

    public static void main(String[] args) {
        // 单旋转，右旋转
        int[] values = {8, 6, 9, 5, 7, 4};
        BalanceBinaryTree tree = BalanceBinaryTree.generate(values);
        // 中序遍历
        tree.show();
        // 是否平衡
        System.out.println("\n是否平衡：" + tree.isBalance());

        System.out.println("=========== 分割线 ===========");
        // 双旋转，先进行左旋转，再右旋转
        values = new int[]{8, 9, 5, 4, 6, 7};
        BalanceBinaryTree tree1 = BalanceBinaryTree.generate(values);
        tree1.show();
        System.out.println("\n是否平衡：" + tree1.isBalance());
    }
}
